<style>
.layui-form-pane .layui-form-label{width:auto;}
.layui-form-item{margin-bottom: 0px;}
.order-time-bg{background-color:#1E9FFF;color:white;padding:0px 5px;}
.time_input{width:300px!important;}
.layui-table-page,.layui-laypage{ height: auto}
.layui-table-page .layui-laypage span,.layui-table-page .layui-laypage a {display: block;float: left;}
.layui-table-page>div { height: auto;}

.layui-table-cell {padding:1px 3px;}
th .layui-table-cell{text-align:center;font-size:13px;line-height:19px;font-weight:bold;white-space:normal;}
</style>
<div class="fixed-bar">
<form class="layui-form layui-form-pane fixed-bar-form" action="{:url()}" method="get" id="hisi-table-search">
<div class="layui-form-item">	
	<div class="layui-inline">
		<label class="layui-form-label">订单号</label>
		<div class="layui-input-inline">
			<input type="text" name="client_ordernum" lay-verify="" placeholder="输入订单号" class="layui-input">
		</div>
	</div>
	{if env('env_site') == 'riwei' }
	<div class="layui-inline">
		<label class="layui-form-label">客户单号</label>
		<div class="layui-input-inline">
			<input type="text" name="ext_id" lay-verify="" placeholder="输入客户单号" class="layui-input">
		</div>
	</div>
	{/if}
	<div class="layui-inline">
		<label class="layui-form-label">SKU</label>
		<div class="layui-input-inline">
			<input type="text" name="sku" lay-verify="" placeholder="输入SKU" class="layui-input">
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">所属工厂</label>
		<div class="layui-input-inline">
			{:Form::select('factory_id', '', $factoryKV, '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">组别</label>
		<div class="layui-input-inline">
			{:Form::select('group_id', '', $groupKV, '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">员工</label>
		<div class="layui-input-inline">
			{:Form::select('admin_id', '', $systemUserKV, '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">工序</label>
		<div class="layui-input-inline">
			{:Form::select('type', '', $checkclothTypeKV, '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">克重超标</label>
		<div class="layui-input-inline">
			{:Form::select('rate', '', ['' => '全部', '1' => '>10克'], '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">档口</label>
		<div class="layui-input-inline">
			{:Form::select('stalls_id', '', $stallsKV, '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">完成情况</label>
		<div class="layui-input-inline">
			{:Form::select('over_type', '', ['' => '', '1' => '未完', '2' => '已完'], '', '')}
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">完成时间</label>
		<div class="layui-input-inline time_input">
			<input type="text" name="over_time_range" readonly="" id="over_time_range" lay-verify="" placeholder="选择完成时间" class="layui-input">
		</div>
	</div>
    <div class="layui-inline">
        <label class="layui-form-label">布种</label>
        <div class="layui-input-inline">
          <input type="text" id="name" name="name" lay-verify="" placeholder="输入布种" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
		<label class="layui-form-label">是否退料</label>
		<div class="layui-input-inline">
			{:Form::select('is_return', '', $is_return_arr, '', '')}
		</div>
	</div>
	<div class="layui-inline removeStat">
		<label class="layui-form-label">物料属性</label>
		<div class="layui-input-inline">
			{:Form::select('stock_m_type', '', [0=>'全部',1=>'常规',2=>'备料'], '', '')}
		</div>
	</div>
	<div class="layui-inline removeStat">
		<label class="layui-form-label">采购批号</label>
		<div class="layui-input-inline">
			<input type="text" name="Bmid" lay-verify="" placeholder="输入采购批号" class="layui-input">
		</div>
	</div>
	<div class="layui-inline">
		<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>
    <button type="button" class="layui-btn layui-btn-primary hisi-export">导出</button>
	</div>
</div>
</form>
</div>

<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" title="操作按钮模板" id="buttonTpl">
    &nbsp; <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe" hisi-data="{width: '470px', height: '600px'}" title="修改验布缩水数据">修改</a>
</script>

<script type="text/html" title="排序模板" id="sortTpl">
    <input type="text" class="layui-input hisi-ajax-input input-sort" onkeyup="value=value.replace(/[^\d]/g,'')" value="{{ d.order }}" data-value="{{ d.id }}" data-href="{:url('sort')}?id={{ d.id }}&field=order">
</script>
<script type="text/html" title="订单号/采购批号" id="client_ordernumTpl">
	{{# if (d.stock_m_type==0){ }}
	<span class="copy-item">{{d.client_ordernum}}</span>
	{{# }else { }}
	<span class="copy-item">B{{d.order_material_id}}</span>
	{{# } }}
</script>
<script type="text/html" id="toolbar">
	<div class="layui-btn-group fr">
		<a data-href="{:url('mp/StockNew/applyCheckInClothShrink')}?" class=" layui-btn layui-btn-primary layui-btn-sm j-page-btns confirm layui-icon back">入库提交</a>&nbsp;&nbsp;
	</div>
</script>
<script type="text/html" title="是否入库" id="stock_action_idTpl">
	{{# if (d.stock_action_id==0){ }}
	<span class="layui-badge">否</span>
	{{# } }}
	{{# if (d.stock_action_id >0 && d.action_state== 110){ }}
	<span class="layui-badge layui-bg-green">是</span>
	{{# } }}
	{{# if (d.stock_action_id >0 && (d.action_state<110 || d.action_state== 999) ){ }}
	<span class="layui-badge">否</span>
	{{# } }}
</script>
<script type="text/javascript">
    layui.use(['table', 'tool', 'jquery', 'laydate', 'form'], function() {
        var $ = layui.jquery;
        var laydate = layui.laydate;
        var form = layui.form;
        var table = layui.table;
        
        laydate.render({
		    elem: '#over_time_range'
		    ,range: '~'
		    ,theme: 'molv'
		    ,type: 'datetime'
		    ,mark: {'{:$today}':''}
		    ,change: function(value, date, endDate){
		    	$('#over_time_range').val(value);
            }
		});
        
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,cellMinWidth: 80
			,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
				{type:'checkbox'},
            	{field: 'user_name', title:'姓名',width:75}
            	,{field: 'role_name', title:'职能',width:75}
            	,{field: 'type_name', title:'工序',width:65}
				,{field: 'client_ordernum', title:'订单号/采购批号' ,width:100 , templet: '#client_ordernumTpl'}
				,{field: 'cloth_num', title:'布号',width:60}
            	,{field: 'material_name', title:'布种',width:120,templet:function(d){return '<span class="copy-item">'+d.material_name+'</span>'}}
				,{field: 'stock_m_type_txt', title:'物料属性',width:60}
				,{field: 'color', title:'颜色'}
            	,{field: 'sku', title:'SKU',width:180,templet:function(d){return '<span class="copy-item">'+d.sku+'</span>'},width:170}
				,{field: 'caigou_over_time_text', title:'批色时间',width:130}
            	,{field: 'over_time_text', title:'完成时间',width:130}
            	,{field: 'cost_time', title:'时长(批色计时)',width:110}
            	,{field: 'over_time', title:'完成情况',templet:function(d){return layui.tool.formatOverStatus(d.over_time)},width:65}
            	,{field: 'tiaoshu', title:'总匹数',width:60}
            	,{field: 'true_fabric_width', title:'实用布封',templet:function(d){return d.true_fabric_width - d.edge_damage},width:60}
				,{field: 'stock_action_id', title:'是否入库',width:60,templet: '#stock_action_idTpl'}
				,{field: 'length', title:'米长',width:60}
            	,{field: 'weight_shrink', title:'缩水前重量',width:76}
            	,{field: 'weight_page', title:'纸筒重量',width:70}
            	,{field: 'length_shrink', title:'缩前米长'}
            	,{field: 'fabric_width_shrink', title:'缩前布封'}
            	,{field: 'length_rate', title:'直缩率'}
            	,{field: 'fabric_width_rate', title:'横缩率'}
            	,{field: 'true_weight', title:'克重'}
            	,{field: 'weight_over', title:'克重超标',templet:function(d){return d.weight_over > 0 ? d.weight_over:''}}
            	,{field: 'edge_damage', title:'布边损料'}
            	,{field: 'is_excess', title:'用料情况',templet:function(d){return d.is_excess > 0 ? '多料':''}}
            	,{field: 'rejects_length', title:'次品数'}
            	,{field: 'rejects_names', title:'次品类型'}
            	,{field: 'is_return', title:'是否退料',templet:function(d){return layui.tool.formatBool(d.is_return)}}
            	,{field: 'stalls_name', title:'档口'}
            	,{field: 'adjust_remark', title:'调整情况'}
            	,{field: 'adjust_time', title:'调整时间'}
            	,{field: 'adjust_user_name', title:'调整员'}
            	,{field: 'edit_remark', title:'修改情况'}
            	,{field: 'edit_time', title:'修改时间'}
            	,{field: 'edit_user_name', title:'修改员'}
                ,{title: '操作', templet: '#buttonTpl', width:70, fixed: 'right'}
            ]]
            ,done:function(res) {
            	var html = '';
            	html += '<span>完成时间:<select lay-ignore>';
            	for(var i in res.stat.over) {
            		html += '<option>'+i+' '+res.stat.over[i]+'</option>';
            	}
            	html += '</select></span>';
            	
            	html += '<span>&nbsp;&nbsp;条数:<select lay-ignore>';
            	for(var i in res.stat.tiaoshu) {
            		html += '<option>'+i+' '+res.stat.tiaoshu[i]+'</option>';
            	}
            	html += '</select></span>';
            	
            	html += '<span>&nbsp;&nbsp;米长:<select lay-ignore>';
            	for(var i in res.stat.length) {
            		html += '<option>'+i+' '+res.stat.length[i]+'</option>';
            	}
            	html += '</select></span>';
            	
            	html += '<span>&nbsp;&nbsp;缩前米长:<select lay-ignore>';
            	for(var i in res.stat.length_shrink) {
            		html += '<option>'+i+' '+res.stat.length_shrink[i]+'</option>';
            	}
            	html += '</select></span>';
            	
            	html += '<span>&nbsp;&nbsp;布封:<select lay-ignore>';
            	for(var i in res.stat.width) {
            		html += '<option>'+i+' '+res.stat.width[i]+'</option>';
            	}
            	html += '</select></span>';
            	
                html += '<span>&nbsp;&nbsp;缩前重量:<select lay-ignore>';
            	for(var i in res.stat.weight_shrink) {
            		html += '<option>'+i+' '+res.stat.weight_shrink[i]+'</option>';
            	}
            	html += '</select></span>';
            	$('.layui-laypage-default').append(html);
                //$('.layui-laypage-default').attr("style","width: auto;");
            	form.render('select');
            }
        });
    });
</script>